print(len("abcds"))   #字符串长度
print(len([1,2,3,4])) #列表长度
print(len((1,2,34,5)))#元组长度
print(len({'name':'ouwen'})) #字典中键值对的数量
print(len({1,2,34})) #集合中元素的长度


print(max([1,2,3,4,5345,345,345,3]))  #列表
print(max((1,2,3,4,5345,345,345,3)))  #元组
print(max({1,2,3,4,5345,345,345,3}))  #集合
print(max('123456'))       #字符串

print(min([1,2,3,4,5345,345,345,3]))  #列表
print(min((1,2,3,4,5345,345,345,3)))  #元组
print(min({1,2,3,4,5345,345,345,3}))  #集合
print(min('123456'))       #字符串

print(sum([1,2,3,4,5]))  #列表
print(sum((1,2,3,4,5)))  #元组
print(sum({1,2,3,4,5}))  #集合


#str.join()
print('-'.join(['2021','1','1'])) #列表
print('-'.join('abcde'))  #字符串
print('-'.join(('2021','1','1'))) #元组
print('-'.join({'2021','1','1'}))  #集合
print('-'.join({'name':'ouwen','age':'18'}))  #字典


info = {'name':'ouwen','age':'18'}
info = ['2021','1','1']
fenge = '?'
result = ''
for item in info:
    result += item + fenge  #    result = result + item + fenge
result = result[0:len(result)-1]
#result = result[:-1]
print(result)



#str.replace(old,new[,count])
txt = '大家好我是一个大聪明,我非常的聪明'
#要求:将字符串里面的 聪明 改为 笨蛋
print(txt.replace('聪明','笨蛋'))
#要求:只需要替换 第一个笨蛋
print(txt.replace('聪明','笨蛋',1))


user_name = '  用户名  '
#去除左右两边的空格
print(user_name.strip('  '))
#去除左边的空格
print(user_name.rstrip('  '))
#去除右边的空格
print(user_name.lstrip('  '))


txt = 'abcDEF'

print(txt.upper())
print(txt.lower())

#split : 从左往右切割
print('a,b,c,d'.split(','))
print('a-b-c-d'.split('-'))

print('a-b-c-d'.split('-',1))
print('a-b-c-d'.split('-',2))

#rstrip : 从右往左切割
print('a,b,c,d'.rsplit(','))
print('a,b,c,d'.rsplit(',',2))

#str.find(sub)
txt = 'abcdefgabcabc'
# 找到字符串中b字符所在的下标位置
print(txt.find('b'))
print(txt.find('x'))

print(txt.find('a',5))
print(txt.find('a',5,8))

#str.index(sub)
txt = 'abcdefgabcabc'
print(txt.index('a'))
print(txt.index('b',1))
print(txt.find('a',5,8))
print(txt.find('x'))



data = 'aaabbbcccabc'
print(data.count('a'))
print(data.count('x'))



s1 = "123"
s2 = "abc"
s3 = "1a2"
s4 = ""
print(s1.isdigit())  # 输出：True
print(s2.isdigit())  # 输出：False
print(s3.isdigit())  # 输出：False
print(s4.isdigit())  # 输出：False